package net.techwatch.jpa.entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
public class Sales {

	private long id;
	private String poNumber;
	private Customer customer;
	private OrderStatus orderStatus;
	private Date orderDate;
	private Date shipDate;
	private Date dateNeeded;
	private long paid;
	private int quantityOdered;
	private long totalValue;
	private int discount;
	private ItemType itempType;
	private int aged;
	
	public Sales() {
		// nothing to do
	}

	/**
	 * @return the id
	 */
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="SALES_ID")
	public long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	private void setId(long id) {
		this.id = id;
	}

	/**
	 * @return the poNumber
	 */
	@Column(name="PRODUCT_NB", nullable=false)
	public String getPoNumber() {
		return poNumber;
	}

	/**
	 * @param poNumber the poNumber to set
	 */
	public void setPoNumber(String poNumber) {
		this.poNumber = poNumber;
	}

	/**
	 * @return the custNo
	 */
	@OneToOne
	@JoinColumn(nullable=false, referencedColumnName="PERSON_ID")
	public Customer getCustomer() {
		return customer;
	}

	/**
	 * @param custNo the custNo to set
	 */
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	/**
	 * @return the orderStatus
	 */
	@Enumerated(EnumType.STRING)
	public OrderStatus getOrderStatus() {
		return orderStatus;
	}

	/**
	 * @param orderStatus the orderStatus to set
	 */
	public void setOrderStatus(OrderStatus orderStatus) {
		this.orderStatus = orderStatus;
	}

	/**
	 * @return the orderDate
	 */
	@Temporal(TemporalType.DATE)
	@Column(name="ORDER_DATE", nullable=false)
	public Date getOrderDate() {
		return orderDate;
	}

	/**
	 * @param orderDate the orderDate to set
	 */
	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}

	/**
	 * @return the shipDate
	 */
	@Temporal(TemporalType.DATE)
	@Column(name="SHIP_DATE", nullable=false)
	public Date getShipDate() {
		return shipDate;
	}

	/**
	 * @param shipDate the shipDate to set
	 */
	public void setShipDate(Date shipDate) {
		this.shipDate = shipDate;
	}

	/**
	 * @return the dateNeeded
	 */
	@Temporal(TemporalType.DATE)
	@Column(name="DATE_NEEDED", nullable=false)
	public Date getDateNeeded() {
		return dateNeeded;
	}

	/**
	 * @param dateNeeded the dateNeeded to set
	 */
	public void setDateNeeded(Date dateNeeded) {
		this.dateNeeded = dateNeeded;
	}

	/**
	 * @return the paid
	 */
	@Basic(optional=false)
	public long getPaid() {
		return paid;
	}

	/**
	 * @param paid the paid to set
	 */
	public void setPaid(long paid) {
		this.paid = paid;
	}

	/**
	 * @return the quantityOdered
	 */
	@Column(name="QUANTITY_ORDERED", nullable=false)
	public int getQuantityOdered() {
		return quantityOdered;
	}

	/**
	 * @param quantityOdered the quantityOdered to set
	 */
	public void setQuantityOdered(int quantityOdered) {
		this.quantityOdered = quantityOdered;
	}

	/**
	 * @return the totalValue
	 */
	@Column(name="TOTAL_VALUE", nullable=false)
	public long getTotalValue() {
		return totalValue;
	}

	/**
	 * @param totalValue the totalValue to set
	 */
	public void setTotalValue(long totalValue) {
		this.totalValue = totalValue;
	}

	/**
	 * @return the discount
	 */
	@Basic(optional=false)
	public int getDiscount() {
		return discount;
	}

	/**
	 * @param discount the discount to set
	 */
	public void setDiscount(int discount) {
		this.discount = discount;
	}

	/**
	 * @return the itempType
	 */
	@Enumerated
	public ItemType getItempType() {
		return itempType;
	}

	/**
	 * @param itempType the itempType to set
	 */
	public void setItempType(ItemType itempType) {
		this.itempType = itempType;
	}

	/**
	 * @return the aged
	 */
	@Basic(optional=false)
	public int getAged() {
		return aged;
	}

	/**
	 * @param aged the aged to set
	 */
	public void setAged(int aged) {
		this.aged = aged;
	}
}
